<template>
	<view class="">
		<cu-custom bgColor="bg-red" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">{{title}}</block>

		</cu-custom>

		<!-- <view class="cu-list menu-avatar"> -->
		<radio-group @change="radioChange" class="cu-list menu-avatar" style="width:100%">
			<view class="cu-item">
				<view class="cu-avatar touxiang round lg" style="background-image:url(../../static/img/Alipay.png);">
				</view>
				<view class="content">
					<view class="">支付宝</view>
					<view class=" text-sm flex">
						<view class="text-cut">
							账号：12121215454
						</view>
					</view>
				</view>
				<view class="action">


					<radio class='radio red' :value="radio[0].type" :checked="postData.type === radio[0].type"></radio>

				</view>
			</view>
			<view class="cu-item">
				<view class="cu-avatar touxiang round lg" style="background-image:url(../../static/img/bank1.png);">
				</view>
				<view class="content">
					<view class="">银行卡</view>
					<view class=" text-sm flex">
						<view class="text-cut">
							账号：12121221454545415454
						</view>
					</view>
				</view>
				<view class="action">
					<radio class='radio red' :value="radio[1].type" :checked="postData.type === radio[1].type"></radio>

				</view>
			</view>

		</radio-group>



		<!-- </view> -->

		<view class="cu-list menu   sm-border bg-whtie">
			<view class=" text-xs padding bg-white">
				<text class="text-xs">提现金额</text>
			</view>

			<view class="cu-form-group  solid-bottom">

				<text class="text-xl">￥</text><input placeholder="" name="input"></input>
			</view>

			<view class=" text-xs padding bg-white flex justify-between">
				<text class="text-sm">可用余额{{userinfo.money}}元</text>
				<text class="text-blue" @click="allRecharing">全部提现</text>
			</view>
		</view>
		<view class=" text-xs padding-sm">
			<text class="text-sm text-red">
				1.每个账号每日只能提现1次
				2.为防止客现，充值会都不可提现
				3中突会断可全部用于概现成参与转充活动
				4.单次提现金顿需大于50元


			</text>
		</view>

		<view class="padding flex flex-direction" @click="sumbit">
			<button class="cu-btn bg-red margin-tb-sm lg">确认提现</button>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: "提现",
				radio: [{
						type: 0
					},
					{
						type: 1
					}
				],
				userinfo: {
					money: 10
				},
				postData: {
					type: 0,
					money:0
				}



			}

		},
		mounted() {

		},
		methods: {
			allRecharing(){
			   (this.userinfo.money!=0)?(()=>{
				   this.postData.money=this.userinfo.money;
			   })():(()=>{
				   this.$Reques.showToast("没有可用的余额");
			   })();
			},
			/**
			 * 选择提现方式
			 */
			radioChange(e) {
				console.log(e);

				this.postData.type = e.detail.value;

			},
			sumbit() {
				let confirm = () => {
						this.$Reques.request(this.$Reques.interface_url.applay, "POST", this.postData).then((res) => {
							this.$Reques.showToast(res.message);
							if (res.status == 200) {


							}
						})
					}
					(this.postData.money != 0) ? confirm() : (() => {

						this.$Reques.showToast("请输入转充的金额");
					})();


			}
		}





	}
</script>

<style scoped>
	.touxiang {
		background-size: cover;
		background-size: 120% 120%;
	}
</style>
